package com.blast.comicsisland.fragment;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import android.widget.TextView;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.blast.comicsisland.R;
import com.blast.comicsisland.utils.ImageLoaderUtil;
import com.facebook.drawee.view.SimpleDraweeView;

/**
 * 推荐页上方ViewPager的fragment
 */
public class AdvertFragment extends Fragment {

    private ImageLoaderUtil instance;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.fragment_advert, container, false);
        Bundle bundle = getArguments();
        String imageurl = bundle.getString("imageurl");
        String title = bundle.getString("title");
        String id = bundle.getString("id");
        TextView textView = (TextView) view.findViewById(R.id.advert_fragemet_title);
        textView.setText(title);
        SimpleDraweeView imageView = (SimpleDraweeView)view.findViewById(R.id.advert_fragment_imageview);
        /*imageView.setDefaultImageResId(R.drawable.imgbg);
        imageView.setErrorImageResId(R.drawable.imgbg);
        instance = ImageLoaderUtil.getInstance();
        ImageLoader imageLoader = instance.getImageLoader();
        imageView.setImageUrl(imageurl,imageLoader);*/
        Uri uri = Uri.parse(imageurl);
        imageView.setImageURI(uri);
        return view;
    }


    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);

    }

    @Override
    public void onDetach() {
        super.onDetach();
    }



}
